package com.study.bootstudy;

//import com.study.bootstudy.listener.MySessionLinstener;
//import com.study.bootstudy.test.MyServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;


@SpringBootApplication
public class BootStudyApplication {

    public static void main(String[] args) {
        SpringApplication.run(BootStudyApplication.class, args);
    }


    //将自定义servlet添加到springboot容器中,配置urlMapping为srv2，就不会再控制台打印俩次111的内容了，servlet的配置就生效了
//    @Bean
//    public ServletRegistrationBean<MyServlet> getServletRegistrationBean() {
//        ServletRegistrationBean<MyServlet> bean = new ServletRegistrationBean<>(new MyServlet(), "/arv2");
//        bean.setLoadOnStartup(1);
//        return bean;
//    }


//    //自定义监听器的实现
//    @Bean
//    public ServletListenerRegistrationBean getServletListenerRegistrationBean() {
//        ServletListenerRegistrationBean srb = new ServletListenerRegistrationBean();
//        srb.setListener(new MySessionLinstener());
//        System.out.println("listener..........监听中.............");
//        return srb;
//    }




}
